]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Set popup menu side via parameter to AppIcon class
authorJonas Dreßler <verdre@v0yd.nl>
Mon, 24 Jul 2023 20:22:49 +0000 (22:22 +0200)
committerJonas Dreßler <verdre@v0yd.nl>
Wed, 30 Jul 2025 20:38:19 +0000 (22:38 +0200)
Let's make the "side" argument to the popupMenu() function for app icons
a param to the AppIcon class itself. The side is not that dynamic that it
needs to be defined on calling of the function, instead it can be defined
on creation of the AppIcon as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3796>

js/ui/appDisplay.js
js/ui/dash.js

index 393e49e988a68f84310bd3f71bcde9468606ccde..c7959f3529f6f0042f76d54452b8975fc628f60e 100644 (file)
@@ -2934,9 +2934,11 @@ export const AppIcon = GObject.registerClass({
     },
 }, class AppIcon extends AppViewItem {
     _init(app, iconParams = {}) {
-        // Get the isDraggable property without passing it on to the BaseIcon:
+        // Get properties without passing them on to the BaseIcon:
         const isDraggable = iconParams['isDraggable'] ?? true;
         delete iconParams['isDraggable'];
+        const popupMenuSide = iconParams['popupMenuSide'] ?? St.Side.LEFT;
+        delete iconParams['popupMenuSide'];
         const expandTitleOnHover = iconParams['expandTitleOnHover'];
         delete iconParams['expandTitleOnHover'];
 
@@ -2945,6 +2947,7 @@ export const AppIcon = GObject.registerClass({
         this.app = app;
         this._id = app.get_id();
         this._name = app.get_name();
+        this._popupMenuSide = popupMenuSide;
 
         this._iconContainer = new St.Widget({
             layout_manager: new Clutter.BinLayout(),
@@ -3078,13 +3081,13 @@ export const AppIcon = GObject.registerClass({
         return this.app.get_id();
     }
 
-    popupMenu(side = St.Side.LEFT) {
+    popupMenu() {
         this.setForcedHighlight(true);
         this._removeMenuTimeout();
         this.fake_release();
 
         if (!this._menu) {
-            this._menu = new AppMenu(this, side, {
+            this._menu = new AppMenu(this, this._popupMenuSide, {
                 favoritesSection: true,
                 showSingleWindows: true,
             });
index 585f340636f7b697d5462140bf904070f17b6c11..f9b55c0403b28819ea1698ab23fdba39188f374d 100644 (file)
@@ -24,13 +24,10 @@ class DashIcon extends AppDisplay.AppIcon {
         super._init(app, {
             setSizeManually: true,
             showLabel: false,
+            popupMenuSide: St.Side.BOTTOM,
         });
     }
 
-    popupMenu() {
-        super.popupMenu(St.Side.BOTTOM);
-    }
-
     // Disable scale-n-fade methods used during DND by parent
     scaleAndFade() {
     }